package nmrworkflow.framework.functionwrappers.nmrpipe;

import nmrworkflow.framework.functionwrappers.Argument;
import nmrworkflow.framework.functionwrappers.Function;

public class NmrPipeZfWrapper extends BaseNmrPipeWrapper {
	
	private int size;
	
	public NmrPipeZfWrapper() {
		super();
		
		size = 0;
	}
	
	public NmrPipeZfWrapper(int size) {
		super();
		
		this.size = size;
	}
	
	public void roundToFourier(int s) {
		size = 	(new Double(
					Math.pow(
						Math.ceil(
							Math.log(s) / Math.log(2)
						), 
					2))
				).intValue();
	}
	
	public void roundToFourierAndDouble(int s) {
		size = 	(new Double(
					2 * Math.pow(
						Math.ceil(
							Math.log(s) / Math.log(2)
						), 
					2))
				).intValue();
	}
	
	@Override
	protected Function buildFunction() {
		Function zf = new Function("ZF");
		zf.addArgument(new Argument("size", size));
		
		return zf;
	}

}
